package com.attendance.www.hr.controller;

import java.util.Date;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.attendance.www.hr.beans.CheckBean;
import com.attendance.www.hr.exception.ResultFaultException;
import com.attendance.www.hr.service.ICheckService;
import com.zhangkongli.frame.core.ResultMap;

/**
 * 验证接口
 * @author 张鑫
 * 2017-11-15
 */
@Controller
@RequestMapping("/check")
public class CheckController {
	
	@Resource
	private ICheckService checkService;
	
	/**
	 * 验证信息现在是否还有效
	 * @param request
	 * @param checkBean
	 * @return
	 */
	@RequestMapping(value = "/getCheckThruDate.do", method = {RequestMethod.POST,RequestMethod.GET})
	@ResponseBody
	public Object getCheckThruDate(HttpServletRequest request, @RequestBody CheckBean checkBean){
		Date thruDate=checkBean.getThruDate();
		if (thruDate==null) {
			throw new ResultFaultException("0_00001");
		}
		return ResultMap.success(checkService.getCheckThruDate(thruDate));
	}

}
